<%@page contentType="application/json" pageEncoding="UTF-8"%><%
    String callback = request.getParameter("callback");

    //Se inici el callback
    out.print(callback + "({");
    String find = request.getParameter("sfind") + "%";
    java.util.List<satk.objetos.Cinta> cintas = new satk.database.ManagerCinta().findCinta(find, 5);

    String numResult = String.format("\"totalResultsCount\":%d ", cintas.size());
    out.print(numResult);

    out.print(", \"cintas\":[");

    int ctrlN = 0;
    for (satk.objetos.Cinta c : cintas) {
        String a = String.format("{\"id\": \"%s\", \"color\": \"%s\"}",
                c.getIdentificador(), c.getColor());
        if (ctrlN > 0) {
            a = "," + a;
        }
        out.print(a);
        ctrlN++;
    }
    out.print("] "); // Termina cintas

    out.print("});"); // Termina callback
%>